﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using testws;

public partial class AddNewaspx : System.Web.UI.Page
{
    testws.Service ws = new Service();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if(ws.AddNewItem(txtName.Text, float.Parse(txtPrice.Text), txtDes.Text))
        {
            Response.Redirect("Main.aspx");
        }
        else
        {
            Response.Write("Insert fail, please try again!");
        }
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Main.aspx");
        //txtName.Text = "";
        //txtPrice.Text = "";
        //txtDes.Text = "";
    }
}